package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.article.domain.TravelCondition;
import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class TravelQuery extends QueryObject{
    private String keyword;//关键字

    private TravelCondition travelCondition;
    private Long destId=-1L;
    private Integer state=-1;// 状态
    private Integer dayType=-1; //旅游 的天数
    private Integer perExpendType= -1; //旅游花费
    private Integer travelTimeType=-1; //旅游时间
    private Integer orderType=1;  //排序
    /**
     * 获取旅游天数的查询范围
     * @return
     */
    public TravelCondition getDays(){
        return TravelCondition.TRAVEL_DAYS.get(dayType);
    }

    /**
     * 获取旅游花费的查询条件
     * @return
     */

    public TravelCondition getPerExpend(){
        return TravelCondition.TRAVEL_PRE_EXPENDS.get(perExpendType);
    }

    /**
     *获取旅游时间的查询条件
     * @return
     */
    public TravelCondition getTravelTime(){
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }

    /**
     * 获取排序的条件
     */
    public String getOrderBy(){
        if(orderType == 1){
            return " t.releaseTime desc";
        }
        return "t.viewnum desc";
    }



}
